darwin: strip Python.app launcher from packaged macOS xcframework#13
Merged
Conversation
CPython's macOS framework build embeds Python.app under
Python.framework/Versions/<X.Y>/Resources/Python.app. The launcher's
Mach-O carries the configure-time --enable-framework path as a
hardcoded `LC_LOAD_DYLIB` load command:
/Users/runner/work/python-build/python-build/darwin/install/
macOS/macosx/python-X.Y.Z/Python.framework/Versions/X.Y/Python
DYLD can't resolve that path on any machine other than the runner that
produced the build. The CPython source tree's `make install` doesn't
post-process this — Beeware's Python-Apple-support patches install_names
to @rpath, but we don't run that step.
The consequence in downstream consumers: when the xcframework lands
inside a host .app's Contents/Frameworks/Python.framework/, macOS
LaunchServices' nested-bundle scan finds Python.app and tries to launch
it, producing a "Python quit unexpectedly" crash report dialog every
time a `flet build` artifact starts. flet-dev/serious-python is currently
working around this by `find ... -name Python.app | xargs rm -rf` after
extracting the tarball; that should live here, in the build pipeline.
For the embedded-interpreter use case (which is all flet-dev/serious-
python builds for) the launcher has no role: libdart_bridge dlopens
Python.framework's main binary directly, the host application supplies
the NSApplication context, and sys.executable resolves to the host app
binary — Python.app would never be exercised.
Iff a downstream consumer needs a true standalone macOS Python launcher
they can take it directly from Python-Apple-support; we'd reintroduce a
fix-up step then. For now: drop it.
Proper upstream fix (Python-Apple-support relocating LC_LOAD_DYLIB to
@rpath in Python.app) tracked as a follow-up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CPython's macOS framework build embeds Python.app under Python.framework/Versions/<X.Y>/Resources/Python.app. The launcher's Mach-O carries the configure-time --enable-framework path as a hardcoded
LC_LOAD_DYLIBload command:DYLD can't resolve that path on any machine other than the runner that produced the build. The CPython source tree's
make installdoesn't post-process this — Beeware's Python-Apple-support patches install_names to @rpath, but we don't run that step.The consequence in downstream consumers: when the xcframework lands inside a host .app's Contents/Frameworks/Python.framework/, macOS LaunchServices' nested-bundle scan finds Python.app and tries to launch it, producing a "Python quit unexpectedly" crash report dialog every time a
flet buildartifact starts. flet-dev/serious-python is currently working around this byfind ... -name Python.app | xargs rm -rfafter extracting the tarball; that should live here, in the build pipeline.For the embedded-interpreter use case (which is all flet-dev/serious- python builds for) the launcher has no role: libdart_bridge dlopens Python.framework's main binary directly, the host application supplies the NSApplication context, and sys.executable resolves to the host app binary — Python.app would never be exercised.
Iff a downstream consumer needs a true standalone macOS Python launcher they can take it directly from Python-Apple-support; we'd reintroduce a fix-up step then. For now: drop it.
Proper upstream fix (Python-Apple-support relocating LC_LOAD_DYLIB to @rpath in Python.app) tracked as a follow-up.